﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Text;

namespace LosConn.Web.Control
{
    public partial class ControlLeft : BasePage.AdminBasePageControl
    {
        public String html = String.Empty;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                BLL.Los_User bll = new BLL.Los_User();
                DataTable dt = bll.GetPurviewList(Session["UserID"].ToString());
                StringBuilder sb = new StringBuilder();
                if (dt != null || dt.Rows.Count > 0)
                {
                    foreach (DataRow dr in dt.Rows)
                    {
                        if (dr["Purview_PID"].ToString().Equals("0"))
                        {
                            sb.AppendFormat("<li class=\"submenu open\"><a href=\"{0}\"><i class=\"icon icon-th-list\"></i><span>{1}</span></a>", dr["Purview_Remark"], dr["Purview_Name"]);
                            sb.Append("<ul>");
                        }
                        else
                        {
                            sb.AppendFormat("<li class=\"\"><a href=\"{0}\">{1}</a></li>", dr["Purview_Remark"], dr["Purview_Name"]);
                        }
                        if (!dr["Purview_PID"].ToString().Equals("0") && dr["Role_Purview_Salt"].ToString().Equals("True"))
                        {
                            sb.Append("</ul></li>");
                        }
                    }
                }
                html = sb.ToString();

            }
        }
    }
}